<template>
  <div>
    <setHeader title="设置" :back-fn="carryout"></setHeader>
    <div class="pagecontent">
      <div class="main_menu" style="margin-bottom: 0.2rem;" @click="goSecurity">
          <label for="">账户与安全</label>
          <a href="javascript:void(0)"><i class="iconfont icon-xiangyou"></i></a>
      </div>
      <router-link to="/NewUserUpdate" class="main_menu" style="border-top: 1px solid #d8d8d8; margin-bottom: 0.2rem;">
          <label for="">编辑</label>
          <a href="javascript:void(0)"><i class="iconfont icon-xiangyou"></i></a>
      </router-link>
      <!-- <router-link to="/giveFeedback" class="main_menu" style="border-top: 1px solid #d8d8d8;">
          <label for="">意见反馈</label>
          <a href="javascript:void(0)"><i class="iconfont icon-xiangyou"></i></a>
      </router-link>

      <router-link to="#" class="main_menu">
          <label for="">分享App</label>
          <a href="javascript:void(0)"><i class="iconfont icon-xiangyou"></i></a>
      </router-link> -->

      <router-link to="/aboutUs" class="main_menu" style="border-bottom: none;">
          <label for="">关于我们</label>
          <a href="javascript:void(0)"><i class="iconfont icon-xiangyou"></i></a>
      </router-link>

      <div class="btn_big_white outlogin">
          <button v-on:click="outlogin">退出登录</button>
      </div>

      <ViewModal :modalState.sync="viewState">
        <security @done="closePageModal" @savedone="saveClick" @setdone="gotoback"></security>
      </ViewModal>

    </div>
  </div>
</template>

<script>
import setHeader from '../public/setHeader.vue';
import security from '../public/security.vue';
import ViewModal from "@/components/View";
  export default {
    data() {
      return {
      	headerTitle:'编辑',
        logining: true,
        viewState: false,
        ruleForm2: {
          username:'', 
          password:'',
        },
        userInfo:'',
        rules2: {
          account: [
            { required: true, message: '请输入账号', trigger: 'blur' },
            //{ validator: validaePass }
          ],
          checkPass: [
            { required: true, message: '请输入密码', trigger: 'blur' },
            //{ validator: validaePass2 }
          ]
        },
        checked: true,
        userImgHeight:'',
        userInfo:''
      };
    },
    components: {
      setHeader,
      ViewModal,
      security,
    },
		created() {
				let that = this;
				that.userInfo = window.localStorage.getItem('userInfo');
				that.userInfo = JSON.parse(that.userInfo);
		},
     mounted() {
      // let that = this;
      // var a = Promise.resolve(this.getUserInfo())
      // a.then(function (result) { 
      //     console.log(result);
      //     that.userInfo = result;
      // })

      // console.log(that.userInfo);
    },
    methods: {
      //完成
      carryout:function(){
        this.$router.push({path:'/userCenter'});
      },
      outlogin:function(){
        localStorage.clear();
        this.$router.push({path:'/'});
      },
      //账号与安全
      goSecurity() {
        this.viewState = true;
      },
      closePageModal() {
        this.viewState = false;
      },
      //保存
      saveClick() {
        this.viewState = false;
      },
      //关闭组件
      gotoback() {
        this.viewState = false;
      },

    }
  }

</script>
<style>
/* @import '../common/css/userCenter.css'; */

.outlogin {
  margin-top: 0.6rem;
}

</style>
